<template>
  <div class="table-selector">
    <div class="selector-header">
      <h2>信息管理系统</h2>
      <div class="tab-buttons">
        <button 
          :class="['tab-button', { active: activeTab === 'student' }]" 
          @click="switchTab('student')"
        >
          学生信息
        </button>
        <button 
          :class="['tab-button', { active: activeTab === 'teacher' }]" 
          @click="switchTab('teacher')"
        >
          教师信息
        </button>
      </div>
    </div>
    
    <div class="tab-content">
      <StudentList v-if="activeTab === 'student'" />
      <TeacherList v-if="activeTab === 'teacher'" />
    </div>
  </div>
</template>

<script>
import StudentList from './StudentList.vue';
import TeacherList from './Teacher.vue';

export default {
  name: 'TableSelector',
  components: {
    StudentList,
    TeacherList
  },
  data() {
    return {
      activeTab: 'student' // 默认显示学生信息表
    };
  },
  methods: {
    switchTab(tab) {
      this.activeTab = tab;
    }
  }
};
</script>

<style scoped>
.table-selector {
  width: 80vw;
  max-width: 1200px;
  margin: 20px auto;
  padding: 25px;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  transition: all 0.3s ease;
}

.selector-header {
  margin-bottom: 30px;
  text-align: center;
}

.selector-header h2 {
  font-size: 28px;
  color: #2c3e50;
  margin-bottom: 20px;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

.selector-header h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(to right, #2c7be5, #5e72e4);
  border-radius: 3px;
}

.tab-buttons {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
}

.tab-button {
  padding: 12px 25px;
  margin: 0 15px;
  background-color: #f8f9fa;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  position: relative;
  
}

.tab-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  transition: all 0.6s ease;
}

.tab-button:hover::before {
  left: 100%;
}

.tab-button:hover {
  background-color: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.tab-button.active {
  background: linear-gradient(to right, #2c7be5, #5e72e4);
  color: white;
  box-shadow: 0 4px 15px rgba(44, 123, 229, 0.3);
}

.tab-content {
  transition: all 0.3s ease;
  
  padding: 0;
}
</style>